package com.yjc.dp;

import java.util.Arrays;

/**
 * 338. 比特位计数
 *
 * @author yjc
 * @create 2024-07-22 10:15
 */
public class Subject_5 {
    public static void main(String[] args) {

        int n = 5;
        int[] dp = new int[n + 1];

        //初始为0
        dp[0] = 0;
        for (int i = 1; i <= n; i++) {
            if (i % 2 == 1) {//奇数
                dp[i] = dp[i - 1] + 1;
            } else {//偶数
                dp[i] = dp[i / 2];
            }
        }
        System.out.println(dp);


    }
}
